<?php
namespace common\components\rbac;

use Yii;
use yii\web\ForbiddenHttpException;
use yii\web\UnauthorizedHttpException;

/**
 * Created by PhpStorm.
 * User: zsd
 * Date: 2018/4/28
 * Time: 下午3:14
 */
class AccessControl extends \mdm\admin\components\AccessControl
{
    /**
     * @param $user
     * @throws \Exception
     */
    protected function denyAccess($user)
    {
        if ($user->getIsGuest()) {
            throw new UnauthorizedHttpException('用户未登陆');
        } else {
            throw new ForbiddenHttpException(Yii::t('yii', 'You are not allowed to perform this action.'));
        }
    }
}